// vue 过滤器
import Vue from 'vue'
export default{

    vueFilter(){
        //退款原因过滤器
       Vue.filter('refundReason',function(value){
         let result="";
         switch (value) {
           case 1:
             result="不喜欢/不想要";
             break;
          case 2:
            result="未按约定时间发货";
            break;
          case 3:
              result="物流一直未送到";
              break;
          case 4:
              result="物流无跟踪记录";
              break;
        case 5:
              result="七天无条件退货";
              break;
        case 6:
              result="商品与描述不符";
              break;
        case 7:
              result="质量问题";
              break;
        case 8:
              result="卖家发错货";
              break;
        case 9:
              result="发票问题";
              break;
         }
         return result;
       });
       //订单状态过滤器
      Vue.filter('orderStatus',function(orderStatus){
          switch (orderStatus){
            case 'wait_confirm':
              orderStatus = "待确认";//待确认
              break;
            case 'wait_pay':
              orderStatus = "待支付";//待支付
              break;
            case 'already_pay':
              orderStatus = "已支付";//已支付
              break;
            case 'wait_delivery':
              orderStatus = "待发货";//待发货
              break;
            case 'not_in_use':
              orderStatus = "待使用";//待收货/待使用/待补录
              break;
            case 'used':
              orderStatus = "已使用";//已签收/已使用/已补录
              break;
            case 'finish':
              orderStatus = "交易完成";//交易完成
              break;
            case 'already_apply_refund':
              orderStatus = "退款申请待审批";//已申请退款
              break;
            case 'already_refund':
              orderStatus = "退款完成";//已退款
              break;
            case 'close':
              orderStatus = "交易关闭";//交易关闭

              break;
            case 'cancel_apply_refund':
              orderStatus = "已取消申请退款";//交易关闭
              break;
          }
          return orderStatus;
      });


      //奢侈品订单订单状态过滤器
      Vue.filter('shepinorderStatus',function(orderStatus){
          switch (orderStatus){
            case 'wait_confirm':
              orderStatus = "待确认";//待确认
              break;
            case 'wait_pay':
              orderStatus = "待支付";//待支付
              break;
            case 'already_pay':
              orderStatus = "已支付";//已支付
              break;
            case 'wait_delivery':
              orderStatus = "待发货";//待发货
              break;
            case 'not_in_use':
              orderStatus = "已发货";//已发货/待使用/待补录
              break;
            case 'used':
              orderStatus = "已签收";//已签收/已使用/已补录
              break;
            case 'finish':
              orderStatus = "交易完成";//交易完成
              break;
            case 'already_apply_refund':
              orderStatus = "退款申请待审批";//已申请退款
              break;
            case 'already_refund':
              orderStatus = "已退款";//已退款
              break;
            case 'close':
              orderStatus = "已失效";//交易关闭/超出可支付时间

              break;
            case 'cancel_apply_refund':
              orderStatus = "已取消申请退款";//交易关闭
              break;
          }
          return orderStatus;
      });
      //电影订单订单状态过滤器
      Vue.filter('movieOrderStatus',function(orderStatus){
          switch (orderStatus){
            case 'wait_confirm':
              orderStatus = "待确认";//待确认
              break;
            case 'wait_pay':
              orderStatus = "待支付";//待支付
              break;
            case 'already_pay':
              orderStatus = "已支付";//已支付
              break;
            case 'wait_delivery':
              orderStatus = "待发货";//待发货
              break;
            case 'not_in_use':
              orderStatus = "待消费";//待收货/待使用/待补录
              break;
            case 'used':
              orderStatus = "已完成";//已签收/已使用/已补录
              break;
            case 'finish':
              orderStatus = "交易完成";//交易完成
              break;
            case 'already_apply_refund':
              orderStatus = "退款申请待审批";//已申请退款
              break;
            case 'already_refund':
              orderStatus = "已退款";//已退款
              break;
            case 'close':
              orderStatus = "交易关闭";//交易关闭

              break;
            case 'cancel_apply_refund':
              orderStatus = "已取消申请退款";//交易关闭
              break;
          }
          return orderStatus;
      });
       //影片状态过滤器
      Vue.filter('movieStatusFilter',function(movieStatus){
          switch (movieStatus){
            case 0:
              movieStatus = "待上架";
              break;
            case 1:
              movieStatus = "上架";
              break;
            case 2:
              movieStatus = "下架";
              break;
          
          }
          return movieStatus;
      });

      //奢侈品退款订单状态过滤器
      Vue.filter('returnOrderStatus',function(orderStatus){
          switch (orderStatus){
            case 0:
              orderStatus = "待审批";
              break;
            case -5:
              orderStatus = "审批驳回";
              break;
            case 5:
              orderStatus = "审批通过";
              break;
            case 10:
              orderStatus = "审批通过，已收到退货";
              break;
            case -10:
              orderStatus = "审批通过，待收到退货";
              break;
            case 15:
              orderStatus = "换货出库";
              break;
            case 20:
              orderStatus = "换货已签收";
              break;
            case -20:
              orderStatus = "换货拒收";
              break;
            case 25:
              orderStatus = "已退款";
              break;
            case -25:
              orderStatus = "拒绝退款";
              break;
            case -30:
              orderStatus = "已取消申请退款";
              break;
          }
          return orderStatus;
      });



      //支付方式
      Vue.filter('payType',function(payType){
          switch (payType){
            case 167:
              payType = "支付宝";//待确认
              break;
            case 168:
              payType = "微信";//待支付
              break;
            case 185:
              payType = "银联";//已支付
              break;
            case 184:
              payType = "金币";//待发货
              break;
            case 166:
              payType = "线下刷卡";//待收货/待使用/待补录
              break;
            case 169:
              payType = "现金";//已签收/已使用/已补录
              break;
            case 186:
              payType = "支票";//交易完成
              break;
            default:
              payType = "其它";//已申请退款
              break;
          }

          return payType;
      });




      //是否开发票
      Vue.filter('invoiceType',function(payType){
          switch (payType){
            case -1:
              payType = "不开";//待确认
              break;
            case 10:
              payType = "个人发票";//待支付
              break;
            case 20:
              payType = "公司发票";//已支付
              break;
            default:
              payType = "其它";//已申请退款
              break;
          }

          return payType;
      });


           //是否开发票
      Vue.filter('logisticsStatus',function(payType){
          switch (payType){
            case -0:
              payType = "无轨迹";//待确认
              break;
            case 1:
              payType = "已揽收";//待支付
              break;
            case 2:
              payType = "在途中";//已支付
              break;
                case 201:
              payType = "到达派件城市";//已支付
              break;
                case 3:
              payType = "已签收";//已支付
              break;
               case 4:
              payType = "问题件";//已支付
              break;
            default:
              payType = "未知";//已申请退款
              break;
          }

          return payType;
      });

  //会员性别
   Vue.filter('sex',function(sex){
          switch (sex){
            case 0:
              sex = "男";
              break;
            case 1:
              sex = "女";
              break;
            case 2:
              sex = "保密";
              break;
            default:
              sex = "未知";
              break;
            }
          return sex;
      });
    //会员状态
     Vue.filter('customerStatus',function(status){
          switch (status){
            case 0:
              status = "正常";
              break;
            case 1:
              status = "已停用";
              break;
            default:
              status = "未知";
              break;
            }
          return status;
      });
     //会员等级
      Vue.filter('customerLevel',function(level){
          switch (level){
            case '10':
              level = "普通";
              break;
            case '20':
              level = "尊荣";
              break;
            case '30':
              level = "钻石";
              break;
            default:
              level = "未知";
              break;
            }
          return level;
      });

         //图片
      Vue.filter('imgurl',function(imgurl){
          return "https://yaolai-img.oss-cn-beijing.aliyuncs.com/"+imgurl;
      });



      //商品详情物流配送方式
      Vue.filter('spuPeisong',function(type){
          switch (type){
            case 10:
              type = "到店自提";
              break;
            case 20:
              type = "物流配送";
              break;
            default:
              type = "未知";
              break;
            }
          return type;
      });

      //交易类型
      Vue.filter('jiaoyileixing',function(type){
          switch (type){
            case 0:
              type = "全款";
              break;
            case 1:
              type = "预定";
              break;
            default:
              type = "未知";
              break;
            }
          return type;
      });

      //运费设置
      Vue.filter('yunfeishezhi',function(type){
          switch (type){
            case 5:
              type = "包邮";
              break;
            case 10:
              type = "到付";
              break;
            case 15:
              type = "偏远地区不包邮";
              break;
            default:
              type = "未知";
              break;
            }
          return type;
      });


      //退换货服务
      Vue.filter('tuihuanhuofuwu',function(type){
          switch (type){
            case 1:
              type = "特殊商品不支持退换货";
              break;
            case 2:
              type = "七天无条件退换";
              break;
            case 3:
              type = "无质量问题不支持退换";
              break;
            default:
              type = "未知";
              break;
            }
          return type;
      });


      //时间格式化
      Vue.filter('timeFormat',function(originTime){
       
        let format="";
          if(originTime){

            format=originTime.substring(0,4)+"-"+originTime.substring(4,6)+"-"+originTime.substring(6,8)+
            " "+originTime.substring(8,10)+":"+originTime.substring(10,12)+":"+originTime.substring(12,14)

          }else{
            return format;
          }


          return format;
      });



    },

}